<template>
    <el-form-item label="年龄" prop="title">
        <div class="flexbox flexcenter checked_list">
            <el-radio label="1" v-model="dataForm.adgroup.audience[dataForm.audience_index].age_all" @change="changeAgeNull">
                <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">不限</div>
            </el-radio>
            <el-checkbox-group v-model="dataForm.adgroup.audience[dataForm.audience_index].age_groups" @change="changeAgeHas">
                <el-checkbox label="AGE_13_17">
                    <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">13-17</div>
                </el-checkbox>
                <el-checkbox label="AGE_18_24">
                    <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">18-24</div>
                </el-checkbox>
                <el-checkbox label="AGE_25_34">
                    <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">25-34</div>
                </el-checkbox>
                <el-checkbox label="AGE_35_44">
                    <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">35-44</div>
                </el-checkbox>
                <el-checkbox label="AGE_45_54">
                    <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">45-54</div>
                </el-checkbox>
                <el-checkbox label="AGE_55_100">
                    <div class="checked_item"><img src="@/assets/img/market_checked.svg" alt="" class="conversion_check">55+</div>
                </el-checkbox>
            </el-checkbox-group>
        </div>
    </el-form-item>
</template>

<script>
export default {
    props:["dataForm"],
    name: "",
    data() {
        return {};
    },
    created() {},
    methods: {
        //年龄选择
        changeAgeNull() {
            this.dataForm.adgroup.audience[this.dataForm.audience_index].age_groups = [];
            this.sessionSave();
        },
        changeAgeHas() {
            if (this.dataForm.adgroup.audience[this.dataForm.audience_index].age_groups.length == 0) {
                this.dataForm.adgroup.audience[this.dataForm.audience_index].age_all= "1";
            } else {
                this.dataForm.adgroup.audience[this.dataForm.audience_index].age_all = "";
            }
            this.sessionSave();
        },

        sessionSave(){
            this.$emit("sessionSave")
        }
    },
    components: {},
};
</script>


<style scoped>
</style>

